package day013.regex;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的qq号码：");
        String qq = sc.nextLine();

        System.out.println(checkQQ(qq));
        System.out.println(checkQQ2(qq));
    }

    private static boolean checkQQ(String qq) {
        if (qq.length() < 5 || qq.length() > 15) {
            return false;
        }

        if (qq.charAt(0) == '0') {
            return false;
        }

        for (int i = 0; i < qq.length(); i++) {
            if (qq.charAt(i) < '0' || qq.charAt(i) > '9') {
                return false;
            }
        }

        return true;
    }

    private static boolean checkQQ2(String qq) {
        return qq.matches("[1-9][0-9]{4,14}");
    }
}
